/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package medicalstorebilling.ulti;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author ADMIN
 */
public class DateConvert {
    private static SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
    public static Date convertDate(String input){
        Date output = new Date();
        if(input.isEmpty() || input == null){
            return null;
        }
        try {
            output = (Date) formatter.parse(input);
        } catch (ParseException ex) {
            Logger.getLogger(DateConvert.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
        return output;
    }
    public static String convertDateToString(Date input){
        SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
        return df.format(input);
    }
}
